<%= form_for(@book, :html => {:multipart => true}) do |f| %>

<div class="buttons">
	<table>
		<tr>
			<td>
			<div class="actions">
				<%= f.submit t('Save'), :id => "yt0" %>
			</div></td>
			<td><%= link_to t('Cancel'), indexbooks_manager_books_path, :class => "button" %></td>
		</tr>
	</table>
</div>
</div>
<div class="content">
	<div id="tab-data">
		<table class="form">
			<% if @book.errors.any? %>
			<tr>
				<td colspan = 2>
				<div id="error_explanation">
					<h2><%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:</h2>

					<ul>
						<% @book.errors.full_messages.each do |msg| %>
						<li>
							<%= msg %>
						</li>
						<% end %>
					</ul>
				</div></td>
			</tr>
			<% end %>
			<tr>
				<td><span class="required">*</span> <%= t('Code') %>:</td>
				<td> <%= f.text_field :code %> </td>
			</tr>
			<tr>
				<td><span class="required">*</span> <%= t('Tittle') %>:</td>
				<td> <%= f.text_field :title %> </td>
			</tr>
			<tr>
				<td><%= t('Author') %>:</td>
				<td> <%= f.text_field :author %> </td>
			</tr>
			<tr>
				<td><%= t('Category') %>:</td>
				<td> <%= f.select :category_id, options_from_collection_for_select(@categories, "id", "name", @book.category_id) %> </td>

			</tr>
			<tr>
				<td><%= t('Price') %>:</td>
				<td> <%= f.text_field :price %> </td>
			</tr>
			<tr>
				<td><%= t('Quantity') %>:</td>
				<td> <%= f.number_field :quantity %> </td>
			</tr>
			<tr>
				<td><%= t('Image') %>:</td>
				<td>
				<div class="imagebook">
					<% if @book.image_url %>
					<%= image_tag @book.image_url, :class => "dashboard-content" %>
					<% else%>
					<%= image_tag 'admin/no_image.jpg', :class => "dashboard-content" %>
					<% end %>
					<br />
					<%= file_field_tag :image %>
				</div></td>
			</tr>
			<tr>
				<td><%= t('Description') %>:</td>
				<td><%= f.text_area :description %></td>
			</tr>
		</table>
	</div>

</div>
</div>
<% end %>